﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace WindowsFormsApplication.MyPassword
{
    public partial class NewUserName : Form
    {
        public event EventHandler eventHandler;
        IPasswordController controller;

        public NewUserName()
        {
            InitializeComponent();
            controller = new PasswordController();
        }

        private void radButton2_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void rbtAdd_Click(object sender, EventArgs e)
        {
            try
            {
                string userName = rtbUserName.Text;
                string password = rtbPassword.Text;
                string url = rtbURL.Text;
                string other = rtbOther.Text;

                controller.SavePassword(userName, password, url, other);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }

        private void NewUserName_Load(object sender, EventArgs e)
        {
            try
            {
                rtbPassword.PasswordChar = '#';
            }
            catch (Exception ex)
            {
                
            }
        }


    }
}
